package com.xiaoma.pattern.proxy.jdk;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

/**
 * @author maj
 * @ClassName HWInvocationHandler
 * @Description
 * @date 2020-09-27 22:37
 */
public class HWInvocationHandler implements InvocationHandler {

  private Object target;

  public HWInvocationHandler(Object target){
    this .target = target;
  }

  public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
    System.out.println( "------插入前置通知代码-------------" );
    Object rs = method.invoke(target,args);
    System.out.println( "------插入后置处理代码-------------" );
    return rs;
  }
}
